package com.boot.security.server.dao.record;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.record.TswWinningRecord;

@Mapper
public interface TswWinningRecordDao {

    @Select("select * from tsw_winning_record t where t.id = #{id}")
    TswWinningRecord getById(Long id);

    @Delete("delete from tsw_winning_record where id = #{id}")
    int delete(Long id);

    int update(TswWinningRecord tswWinningRecord);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_winning_record(user_id, winning_type,winning_type, winning_price, winning_sycee, coupon_id, winning_time, winning_note, winning_remark) values(#{userId}, #{winningTypewinningType}, #{winningPrice}, #{winningSycee}, #{couponId}, #{winningTime}, #{winningNote}, #{winningRemark})")
    int save(TswWinningRecord tswWinningRecord);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswWinningRecord> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
